package com.example.venadaoa.activity.setting;


import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.TextView;
import com.example.venadaoa.R;
import com.example.venadaoa.base.BaseActivity;
import com.example.venadaoa.datamanager.MenuManage;
import com.example.venadaoa.tool.ViewUtils;


/**
 * Created by Dell on 2017/7/12.
 */

public class OptionMenuActivity extends BaseActivity {
    private OptionMenuActivity optionMenuActivity;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.other_menu_view);
        mPageName = "OptionMenuActivity";
        optionMenuActivity = this;

        ListView listView = (ListView) findViewById(R.id.list);

        TextView title = (TextView) findViewById(R.id.title_content);
        title.setText(this.getString(R.string.system_manage));
        findViewById(R.id.title_bar_btn_left).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View arg0) {
                finish();
            }
        });
        ViewUtils view1 = new ViewUtils(this, R.layout.other_view_item);

        view1.setList(MenuManage.getInstence().getMainMenu(this, MenuManage.getInstence().menu3Id));
        listView.setAdapter(view1);
        listView.setOnItemClickListener(new AdapterView.OnItemClickListener(){

            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                ListView listView = (ListView) parent;
                switch (position) {
                    case 0:
                        Intent intent = new Intent(optionMenuActivity, PersonalInfoActivity.class);
                        startActivity(intent);
                        break;

                    case 1: {
                        Intent intent1 = new Intent(optionMenuActivity, ModifyPwActivity.class);
                        startActivity(intent1);
                    }

                    break;

                    case 2:
                        Intent intent2 = new Intent(optionMenuActivity, AboutActivity.class);
                        startActivity(intent2);
                        //Toast.makeText(optionMenuActivity, "关于", Toast.LENGTH_SHORT).show();
                        break;

                    default:
                        break;
                }

            }
        });
    }
}